window.onload = function(){
    /*720代表设计师给的设计稿的宽度，你的设计稿是多少，就写多少;100代表换算比例，这里写100是
      为了以后好算,比如，你测量的一个宽度是100px,就可以写为1rem,以及1px=0.01rem等等*/
    getRem(375,100)
};
window.onresize = function(){
    getRem(375,100)
};
FastClick.attach(document.body);
function getRem(pwidth,prem){
    var html = document.getElementsByTagName("html")[0];
    var oWidth = document.body.clientWidth || document.documentElement.clientWidth;
    html.style.fontSize = oWidth/pwidth*prem + "px";
}

$(document).ready(function(){
            var myscroll;
            function loaded(){
                setTimeout(function(){
                    myscroll=new iScroll("wrapper",{
                        hScrollbar:false,
                        vScrollbar:false,
                        hScroll:true,
                        vScroll:false,
                        momentum:true,
                        bounce: true,
                        snap:false,
                        preventDefault:false,
                        checkDOMChanges:true,
                        mouseWheel:true, //侦听鼠标滚轮事件
            
                        //重写这个方法，因为isScroll让输入框禁用了
                        onBeforeScrollStart: function (e) { 
                            var target = e.target; 
                            while (target.nodeType != 1) target = target.parentNode; 
                            if (target.tagName != 'SELECT' && target.tagName != 'INPUT' && target.tagName != 'TEXTAREA') 
                                e.preventDefault(); 
                            }
                    });
                },100 );
            }
            
            window.addEventListener("load",loaded,false);
           
           
        });

var mySwiper = new Swiper ('.swiper-container', {
    direction: 'horizontal',
    loop: true,
    speed:300,
    autoplayDisableOnInteraction: false,
    pagination: {
      el: '.swiper-pagination',
    }
  })  
setInterval("mySwiper.slideNext()", 4000);


$('.coop-center li').on('tap',function(e){
    $(this).addClass('border').siblings('li').removeClass('border');
    if($(this).index()==0){
        $('.coop-img1').show().siblings('.coop-img2').hide();
    }else {
        $('.coop-img1').hide().siblings('.coop-img2').show();
    }
    // alert(typeof $(this).index())
})